<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- SEO Meta标签 -->
    <title>IP地址定位分析 - 在线查询IP地理位置、ISP信息和归属地</title>
    <meta name="description" content="IP地址定位分析系统，提供精准的IP地理位置查询、ISP信息获取和归属地分析服务。免费在线工具，支持API调用。">
    <meta name="keywords" content="IP地址定位,IP查询,IP归属地,IP分析,地理位置查询,ISP信息">
    <meta name="author" content="IP地址定位分析系统">
    <meta name="robots" content="index, follow">
    <meta name="revisit-after" content="7 days">
    <meta name="theme-color" content="#3498db">
    
    <!-- Open Graph标签 -->
    <meta property="og:title" content="IP地址定位分析 - 在线查询IP地理位置、ISP信息和归属地">
    <meta property="og:description" content="IP地址定位分析系统，提供精准的IP地理位置查询、ISP信息获取和归属地分析服务。免费在线工具，支持API调用。">
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://ip997.com">
    <meta property="og:image" content="https://ip997.com/static/ip_analysis/logo.png">
    
    <!-- Twitter卡片 -->
    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="IP地址定位分析 - 在线查询IP地理位置、ISP信息和归属地">
    <meta name="twitter:description" content="IP地址定位分析系统，提供精准的IP地理位置查询、ISP信息获取和归属地分析服务。免费在线工具，支持API调用。">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 0;
            color: #333;
        }
        .container {
            max-width: 732px;
            width: 90%;
            margin: 40px auto;
            background-color: white;
            padding: 40px;
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        }
        h1 {
            text-align: center;
            color: #2c3e50;
            margin-bottom: 20px;
            font-size: 28px;
            font-weight: 700;
        }
        .form-group {
            margin-bottom: 30px;
        }
        label {
            display: block;
            margin-bottom: 10px;
            font-weight: 600;
            color: #2c3e50;
            font-size: 16px;
        }
        input[type="text"] {
            width: 100%;
            padding: 16px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 18px;
            transition: border-color 0.3s, box-shadow 0.3s;
            box-sizing: border-box;
        }
        input[type="text"]:focus {
            outline: none;
            border-color: #3498db;
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
        }
        button {
            background: linear-gradient(135deg, #3498db, #2980b9);
            color: white;
            border: none;
            padding: 16px 30px;
            border-radius: 8px;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
        }
        button:hover {
            background: linear-gradient(135deg, #2980b9, #1f5f8b);
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
        }
        .client-ip {
            color: #2c3e50;
            background: linear-gradient(135deg, #f8f9fa, #e9ecef);
            padding: 20px 25px;
            border-radius: 12px;
            margin-bottom: 30px;
            font-size: 18px;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            border: 1px solid #e0e0e0;
        }
        .location-separator {
            color: #bdc3c7;
            margin: 0 5px;
        }
        .error {
            color: #e74c3c;
            background-color: #fee;
            padding: 10px;
            border-radius: 5px;
            margin-top: 15px;
        }
        .description {
            text-align: center;
            color: #7f8c8d;
            margin-bottom: 30px;
            font-size: 16px;
            max-width: 600px;
            margin-left: auto;
            margin-right: auto;
            line-height: 1.6;
        }
        .command-box {
            color: rgb(247, 250, 247);
            background-color: black;
            padding: 15px;
            border-radius: 8px;
            font-family: 'Courier New', monospace;
            font-size: 16px;
            overflow-x: auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>IP地址定位分析</h1>
        <p class="description">输入IP地址，获取详细的地理位置、ISP和其他相关信息</p>
        
        {% if client_ip or geo_location %}
            <div class="client-ip">
                {% if client_ip %}
                    当前IP地址: <strong>{{ client_ip }}</strong>
                {% endif %}
                {% if geo_location %}
                    <span class="location-separator">|</span>
                    归属地: <strong>{{ geo_location.country }}</strong> · {{ geo_location.province }} · {{ geo_location.city }}
                {% endif %}
            </div>
        {% endif %}
        
        {% if error %}
            <div class="error">
                {{ error }}
            </div>
        {% endif %}
        
        <form method="post">
            {% csrf_token %}
            <div class="form-group">
                <label for="ip_address">IP地址</label>
                <input type="text" id="ip_address" name="ip_address" placeholder="请输入IP地址，例如：8.8.8.8" required>
            </div>
            <button type="submit">分析</button>
        </form>
        <p>通过命令获取您的本机出口IP地址：</p>
            <div class="command-box">
                curl ip997.com
            </div>
    </div>
</div>

<!-- 底部功能板块 -->
<div style="background-color: white; padding: 40px 15px; margin-top: 40px; width: 100%; border-top: 1px solid #e0e0e0;">
    <div style="max-width: 1000px; margin: 0 auto;">
        <h2 style="color: #2c3e50; text-align: center; margin-bottom: 30px; font-size: 24px; font-weight: 700;">热门资源</h2>
        
        <div style="display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between;">
            <!-- 第一列：热门文章列表 -->
            <div style="flex: 1; min-width: 220px; max-width: 30%;">
                <h3 style="color: #3498db; margin-bottom: 15px; font-size: 16px; font-weight: 600; display: flex; align-items: center;">
                    <span style="margin-right: 8px;">🔥</span>热门文章
                </h3>
                
                {% if hot_articles %}
                <ul style="list-style: none; padding: 0; margin: 0;">
                    {% for article in hot_articles %}
                    <li style="margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;">
                        <a href="{% url 'article_detail' article.id %}" style="color: #2c3e50; text-decoration: none; font-weight: 500; transition: color 0.3s ease; display: block; margin-bottom: 5px; font-size: 14px; line-height: 1.4;">{{ article.title|truncatechars:30 }}</a>
                        <!-- <div style="color: #7f8c8d; font-size: 12px; display: flex; align-items: center;">
                            <span style="margin-right: 5px;">👁️</span>
                            {{ article.view_count }}
                        </div> -->
                    </li>
                    {% endfor %}
                </ul>
                {% else %}
                <p style="color: #7f8c8d; text-align: center; padding: 20px 0; font-size: 14px;">暂无热门文章</p>
                {% endif %}
            </div>
            
            <!-- 第二列：最新文章列表 -->
            <div style="flex: 1; min-width: 220px; max-width: 30%;">
                <h3 style="color: #3498db; margin-bottom: 15px; font-size: 16px; font-weight: 600; display: flex; align-items: center;">
                    <span style="margin-right: 8px;">📝</span>最新文章
                </h3>
                
                {% if latest_articles %}
                <ul style="list-style: none; padding: 0; margin: 0;">
                    {% for article in latest_articles %}
                    <li style="margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;">
                        <a href="{% url 'article_detail' article.id %}" style="color: #2c3e50; text-decoration: none; font-weight: 500; transition: color 0.3s ease; display: block; margin-bottom: 5px; font-size: 14px; line-height: 1.4;">{{ article.title|truncatechars:30 }}</a>
                        <!-- <div style="color: #7f8c8d; font-size: 12px;">
                            {{ article.publish_date|date:"Y-m-d" }}
                        </div> -->
                        {% if article.is_sticky %}
                        <span style="background-color: #f1c40f; color: white; font-size: 10px; padding: 2px 6px; border-radius: 10px; margin-top: 5px; display: inline-block;">置顶</span>
                        {% endif %}
                    </li>
                    {% endfor %}
                </ul>
                {% else %}
                <p style="color: #7f8c8d; text-align: center; padding: 20px 0; font-size: 14px;">暂无最新文章</p>
                {% endif %}
            </div>
            
            <!-- 第三列：热门网络工具列表 -->
            <div style="flex: 1; min-width: 220px; max-width: 30%;">
                <h3 style="color: #3498db; margin-bottom: 15px; font-size: 16px; font-weight: 600; display: flex; align-items: center;">
                    <span style="margin-right: 8px;">🛠️</span>热门工具
                </h3>
                
                {% if hot_tools %}
                <ul style="list-style: none; padding: 0; margin: 0;">
                    {% for tool in hot_tools %}
                    <li style="margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;">
                        <a href="{% url 'article_detail' tool.id %}" style="color: #2c3e50; text-decoration: none; font-weight: 500; transition: color 0.3s ease; display: block; margin-bottom: 5px; font-size: 14px; line-height: 1.4;">{{ tool.title|truncatechars:30 }}</a>
                        <!-- <div style="color: #7f8c8d; font-size: 12px; display: flex; align-items: center;">
                            <span style="margin-right: 5px;">👁️</span>
                            {{ tool.view_count }}
                        </div> -->
                    </li>
                    {% endfor %}
                </ul>
                {% else %}
                <p style="color: #7f8c8d; text-align: center; padding: 20px 0; font-size: 14px;">暂无热门工具</p>
                {% endif %}
            </div>
        </div>
    </div>
</div>

<footer style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; text-align: center; padding: 30px 15px; margin-top: auto; font-size: 14px; width: 100%;">
    <div style="max-width: 800px; margin: 0 auto;">
        <div style="display: flex; justify-content: center; gap: 30px; flex-wrap: wrap;">
            <!-- <div style="text-align: center; margin-bottom: 20px;">
                <div style="font-size: 24px; margin-bottom: 10px;">📁</div>
                <div style="font-weight: 600; margin-bottom: 8px; font-size: 15px;">最新源代码</div>
                <a href="https://gitee.com/yyping2019/ip-region-query.git" target="_blank" style="color: rgba(255,255,255,0.9); text-decoration: none; font-weight: 500; transition: all 0.3s ease;" 
                   onmouseover="this.style.color='white'; this.style.transform='translateY(-1px)';" 
                   onmouseout="this.style.color='rgba(255,255,255,0.9)'; this.style.transform='translateY(0);'">
                    Gitee仓库 →
                </a>
            </div>
            <div style="text-align: center;">
                <div style="font-size: 24px; margin-bottom: 10px;">👨‍💻</div>
                <div style="font-weight: 600; margin-bottom: 8px; font-size: 15px;">开发者联系</div>
                <a href="mailto:admin@ip997.com" style="color: rgba(255,255,255,0.9); text-decoration: none; font-weight: 500; transition: all 0.3s ease;"
                   onmouseover="this.style.color='white'; this.style.transform='translateY(-1px)';" 
                   onmouseout="this.style.color='rgba(255,255,255,0.9)'; this.style.transform='translateY(0);'">
                    admin@ip997.com
                </a>
            </div>
        </div> -->
        <div style="margin-top: 20px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); font-size: 12px;">
            © 2025 IP地址定位分析系统 | 基于Django开发 联系:admin@ip997.com
        </div>
    </div>
</footer>

<style>
    body {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    .container {
        flex: 1;
    }
    
    /* 响应式设计 */
    @media (max-width: 768px) {
        .container {
            padding: 25px;
            margin: 20px auto;
            width: 95%;
        }
        
        h1 {
            font-size: 24px;
            margin-bottom: 15px;
        }
        
        .description {
            font-size: 14px;
            margin-bottom: 25px;
        }
        
        input[type="text"] {
            font-size: 16px;
            padding: 14px;
        }
        
        button {
            font-size: 16px;
            padding: 14px 25px;
        }
        
        .client-ip {
            font-size: 16px;
            padding: 15px 20px;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }
        
        .command-box {
            font-size: 14px;
            padding: 12px;
        }
        
        /* 热门资源板块响应式 */
        .container + div {
            padding: 25px 15px;
            margin-top: 20px;
        }
        
        .container + div h2 {
            font-size: 20px;
            margin-bottom: 20px;
        }
        
        .container + div h3 {
            font-size: 16px;
            margin-bottom: 15px;
        }
        
        .container + div > div > div {
            min-width: 100%;
            max-width: 100%;
        }
    }
    
    @media (max-width: 480px) {
        .container {
            padding: 20px;
            margin: 15px auto;
            border-radius: 12px;
        }
        
        h1 {
            font-size: 22px;
        }
        
        label {
            font-size: 14px;
        }
        
        /* 热门资源板块响应式 */
        .container + div {
            padding: 20px 10px;
            margin-top: 15px;
        }
        
        .container + div h2 {
            font-size: 18px;
        }
        
        .container + div h3 {
            font-size: 15px;
        }
    }
</style>
</body>
</html>